home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #6
/
Amiga Plus CD - 2004 - No. 06.iso
/
AmigaPlus
/
Begleitmaterial
/
amiganews
/
Anzeige_Browser
/
AWeb_APL_060
/
Docs
/
docsearch.awebrx
< prev
next >
Wrap
Text File
|
2003-03-28
|
5KB
|
135 lines
/*******************************************************************
* *
* Docsearch.awebrx *
* *
* © 1997 Yvon Rozijn *
* *
* Search in AWeb documentation. Generate index if requested or *
* no index file exists yet. Search the index file and pass *
* results on to AWeb. *
* *
*******************************************************************/
/*******************************************************************
* *
* To use this as a search engine for your own set of local HTML *
* files, adjust the following variables: *
* *
* index = path of index file */
index = 'AWebPAth:docs/docsearch.index'
/* makeindex = full command line to make the index. *
* The makeindex program takes template: DIR/A/M,TO/A *
* DIR = directories to search for #?.html files (not recursive) *
* TO = name of index file to create */
makeindex = 'AWebPath:docs/makeindex AWebPath:docs AWebPath:docs/plugins AWebPath:docs/settings AWebPath:docs/arexx' index
/* resultfile = path of file to store search result */
resultfile = 'T:docsearch'
/* searchindex = full command line to search the index, the search *
* argument will be appended. *
* The searchindex program takes template: INDEX/A,TO/A,SEARCH/A/F *
* INDEX = path of index file *
* TO = path of search result *
* SEARCH = string to search */
searchindex = 'AWebPath:docs/searchindex' index resultfile
/* and adjust the HTML used in the search result to fit your *
* application. *
* *
*******************************************************************/
options results
options failat 20
parse source dummy1 dummy2 programname .
parse arg sarg
search=''
regenerate=''
interpret sarg
if search='' & regenerate='' then exit
su=upper(search)
nl='0a'x
if regenerate~='' | ~exists(index) then do
'chanopen "x-nil:docsearch/creating index"'
ch=result
'open "x-nil:docsearch/creating index"'
'chanheader' ch '"content-type: text/html"'
'chanheader' ch '"pragma: no-cache"'
doc='<HTML><TITLE>Creating search index</TITLE>*N'
doc=doc || '<BODY><H1>Creating index</H1>*N'
doc=doc || 'A search index is being created. Please be patient...'
'chandata' ch '"' || doc || '" nl'
'chanclose' ch
address command makeindex
end
if search='' then do
'go back'
exit
end
if ~exists(index) then exit
'chanopen "file:///nil:docsearch/' || search || '"'
ch=result
'chanheader' ch '"content-type: text/html"'
'chanheader' ch '"pragma: no-cache"'
doc='<HTML><TITLE>Search result:' search '</TITLE>*N'
doc=doc || '<BASE HREF=file:///AWebPath:docs/aweb.html>*N'
doc=doc || '<BODY BACKGROUND=awebbg.iff>*N'
doc=doc || '<H1><IMG SRC=aweb.iff width=192 height=93 alt=(logo)> Search result:' search '</H1>*N'
'chandata' ch '"' || doc || '" nl'
doc='<FORM ACTION=x-aweb:rexx/' || programname || '>*N'
doc=doc || 'Search in documentation: <input name=search size=25 value=*"' || search || '*"> <input type=submit value=Search>*N'
doc=doc || '</FORM>*N'
doc=doc || '<OL>'
'chandata' ch '"' || doc || '" nl'
'open "file:///nil:docsearch/' || search || '"'
'allowcmd'
address command searchindex '"' || search || '"'
if open(f,resultfile,'R') then do
do until length(block)<480
block=readch(f,480)
'chandata' ch '"' || block || '"'
end
call close f
address command 'delete' resultfile 'quiet'
end
doc='</OL>*N'
doc=doc || '<HR><A HREF=file:///AWebPath:docs/aweb.html>Back to index</a>*N'
doc=doc || '<BR><BR><HR><FORM ACTION=x-aweb:rexx/' || programname || '>*N'
doc=doc || '<B>TIP:</B> After you have added new documentation files,*N'
doc=doc || '<INPUT TYPE=SUBMIT NAME=Regenerate VALUE=Regenerate>*N'
doc=doc || 'the search index for correct search results.*N</FORM>'
'chandata' ch '"' || doc || '" nl'
'chanclose' ch